package com.travelsky.app.util.pdf;


public class PdfWriteUtil
{ 
	/**
	 * 生成pdf文档
	 * @param args
	 * @throws Exception
	 */
	
//	public static String createPdfOfOrder(List list,String file,String pnrid,Double amount)throws Exception{
//		Document document = new Document(PageSize.A4, 50, 50, 50, 50);
////		String filePath = PdfWriteUtil.class.getResource("/").getPath()+"../download/";
////        String fileName = "东航订单详情" +new SimpleDateFormat("yyyyMMddHHmmssss").format(new Date())+".pdf";
//		try{		
//		if(list!=null&&list.size()>0){
//			BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);    
//            Font FontChinese = new Font(bfChinese, 12, Font.NORMAL); 
//            Font f8 = new Font(bfChinese, 10, Font.NORMAL);
//            Font f10 = new Font(bfChinese, 9, Font.BOLDITALIC);
//            Font f9 = new Font(bfChinese, 9 , Font.BOLDITALIC);
//            Font f12 = new Font(bfChinese, 12, Font.BOLD);
//            Font FontChineseTit = new Font(bfChinese, 12, Font.NORMAL); 
//            Font red = new Font(bfChinese, 8, Font.BOLD,new Color(255,0,0));
//           // FontChineseTit.setStyle("alignment:"+Element.ALIGN_RIGHT);
//            //file path 
//            
//			PdfWriter writer = PdfWriter.getInstance(document,new FileOutputStream(file));
//			
//			document.addAuthor("中国东方航空");   
//			document.addSubject("中国东方航空订单详情");
//			 
//		       /**加入显示页码**/
//		       HeaderFooter footer = new HeaderFooter(new Phrase("页数："), true);
//		       footer.setBorder(com.lowagie.text.Rectangle.NO_BORDER);
//		       footer.setAlignment(Element.ALIGN_RIGHT);
//		       //document.setFooter(footer);
//
//			document.open();
//			PdfPTable tableImg = new PdfPTable(1);
//			String path = new PathDetector().getResult();
//			String pa = path.substring(0,path.indexOf("WEB-INF"));
//			Image img1 =Image.getInstance(pa+"/images/ebill.jpg");
////			img1.setWidthPercentage(1);
//			PdfPCell cellImg = new PdfPCell(img1,true);
//			//cellImg.setFixedHeight(70);
//			tableImg.addCell(cellImg);
//			tableImg.setWidthPercentage(100);
//			document.add(tableImg);
//			Paragraph gra = new Paragraph("欢迎您乘坐中国东方航空公司班机。",f10);
//			//gra.setAlignment(Element.ALIGN_CENTER);
//			document.add(gra); 
//			document.add(new Paragraph(Chunk.NEWLINE));/**添加空行**/
//			gra = new Paragraph("● 此行程提示表明您网上购票成功。",f10);
//			document.add(gra); 
//			gra = new Paragraph("● 东航国际航班将在起飞前2小时开始办理乘机手续，起飞前45分钟停止办理；国内航班将在起飞前" +
//					"90分钟开始办理乘机手续，起飞前30分钟停止办理（上海虹桥机场起飞前45分钟停止办理；其他城市" +
//					"值机关闭时间的变更详见本网站东航公告）。请您凭网上购票时所使用的有效旅行证件在上述时限内" +
//					"到达机场柜台办理乘机手续。",f10);
//			document.add(gra); 
//			gra = new Paragraph("● 请您确保网站上填写的有效身份证件号码正确，以免影响您办理乘机手续。",f10);
//			document.add(gra); 
//			gra = new Paragraph("● 您可在东航各地直属售票处或机场东航票台领取电子客票报销凭证（即行程单）。",f10);
//			document.add(gra); 
//			document.add(new Paragraph(Chunk.NEWLINE));/**添加空行**/
//			gra = new Paragraph("Welcome to take the flight of China Eastern Air.",f10);
//			document.add(gra); 
//			document.add(new Paragraph(Chunk.NEWLINE));/**添加空行**/
//			gra = new Paragraph("● This itinerary sheet indicates that you have successfully purchased tickets on line.",f10);
//			document.add(gra); 
//			gra = new Paragraph("● The check-in of China Eastern international flight could be handled 2 hours before the departure, " +
//					"and will be closed before 45 minuets of departure. The check-in of China Eastern domestic flight could be handled 90 minutes " +
//					"before the departure, and will be closed before 30 minuets of departure.(The check-in will be closed before 45 minutes of departure" +
//					" at Shang Hai Hong Qiao Airport;  please check the notes on the website of China Eastern " +
//					"for the closing time of check-in in other cities).",f10);
//			document.add(gra); 
//			gra = new Paragraph("● Please handle check-in at the airport counter in time with the validate travel identification which you used when purchasing.",f10);
//			document.add(gra); 
//			gra = new Paragraph("● Please ensure the correction of the identification number which you fill in the website, in case of influencing your check-in.",f10);
//			document.add(gra); 
//			gra = new Paragraph("● You could get your E-ticket receipt (“itinerary sheet”) at direct offices or airport counters of China Easter all around China.",f10);
//			document.add(gra);
//			 document.add(new Paragraph(Chunk.NEWLINE));/**添加空行**/
//			for(int i=0;i<list.size();i++){
//				OrdInfoVO ordVO = (OrdInfoVO) list.get(i);				  
//	          
//	            document.add(new Paragraph(Chunk.NEWLINE));/**添加空行**/
//	            //divide by pnrvo
//	            Set pnrset = ordVO.getPnrInfoVOs();
//	            Iterator it = pnrset.iterator();
//	            while(it.hasNext()){
//	            	PnrInfoVO pnrVO = (PnrInfoVO) it.next();
//	            	// 订单详细打印只打印当前PNR by zhangyl
//	            	if(pnrid!=null){
//	            		if(!pnrVO.getId().equals(Long.valueOf(pnrid)))
//	            			continue;
//	            	}
//	            	else{
//	            		if(pnrVO.hasNotBeenPaidPnr())
//	            		continue;
//	            	}
//	            	//edit by zhangyl 20100112
//	            	Set paxset = pnrVO.getPnrPaxSet();
//	            	Iterator itpax = paxset.iterator();
//	            	while(itpax.hasNext()){
//	            		PnrPaxVO paxvo = (PnrPaxVO) itpax.next();
//	            		// 判断若分离了PNR,将被分离的乘客去除 by zhangyl
//	            		if(pnrid!=null&&paxvo.getDelFlag().equals(Long.valueOf(0)))
//	            		{ 
//	            			continue;
//	            		}
//	            		PdfPTable table1 = new PdfPTable(4);
//	            		 PdfPCell cell = new PdfPCell(new Phrase("票号\r\nELECTRONIC TICKET FORM AND SERIAL NUMBER",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(paxvo.getOrdTktVO().getTktNo(),f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase("出票处信息\r\n AGENT INFO",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase("东航电子客票商务网站",f8));
////	            		 cell = new PdfPCell(new Phrase(paxvo.getOrdTktVO().getEtdzOffice(),f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 
//	            		 table1 = new PdfPTable(4);
//	            		 cell = new PdfPCell(new Phrase("出票时间 \r\n DATE",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(DateUtil.getChineseDate(paxvo.getOrdTktVO().getEtdzDate()),f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase("身份识别号码\r\nID NUMBER",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(paxvo.getIdNo(),f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 
//	            		 table1 = new PdfPTable(4);
//	            		 cell = new PdfPCell(new Phrase("旅客姓名\r\nNAME OF PASSENGER",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase("\t\t\t\t\t\t\t\t\t"+paxvo.getPaxName(),f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setColspan(3);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 
//                    	 //第一航段
//	            		 Double sales = new Double(0);
//	            		 Double tax = new Double(0);
//                    	 PnrSegVO segvo = paxvo.getFirstPnrSegVO();
//                    	 sales+=segvo.getPriceByPax(paxvo.getPaxType());
//                    	 tax+=segvo.getTaxAllByPax(paxvo.getPaxType());
//                    	 table1 = new PdfPTable(4);
//                    	 cell = new PdfPCell(new Phrase("订座纪录编号\r\nBOOKING REFERENCE",f10));
//                    	 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//                    	 table1.addCell(cell);
//	            		 cell= new PdfPCell();
//	            		 cell.setColspan(3);
//	            		 cell.setPaddingLeft(0);
//	            		 cell.setPaddingRight(0);
//	            		 cell.setPaddingTop(0);
//	            		 cell.setPaddingBottom(0);
//	            		 cell.setPadding(0);
//	            		 PdfPTable table2 = new PdfPTable(5);
//	            		 PdfPCell  cell2 = new PdfPCell(new Phrase(pnrVO.getPnrNo(),f8));
//	            		 cell2.setFixedHeight(35);
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase("航班号\r\nFLIGHT",f10));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase(segvo.getFlightNo(),f8));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase("舱位\r\nCLASS",f10));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase(segvo.getCabinCodeCn(),f8));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 table2.setWidthPercentage(100);
//	            		 cell.addElement(table2);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 
//	            		 table1 = new PdfPTable(4);
//                    	 cell = new PdfPCell(new Phrase(null,f10));
//                    	 table1.addCell(cell);
//	            		 cell= new PdfPCell();
//	            		 cell.setColspan(3);
//	            		 cell.setPaddingLeft(0);
//	            		 cell.setPaddingRight(0);
//	            		 cell.setPaddingTop(0);
//	            		 cell.setPaddingBottom(0);
//	            		 cell.setPadding(0);
//	            		  table2 = new PdfPTable(5);
//	            		  cell2 = new PdfPCell(new Phrase(null,f8));
//	            		 cell2.setFixedHeight(35);
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase("订座情况\r\nSTATUS",f10));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 if(pnrVO.getPnrStatus().equals(BaseConst.ORDERSTATUS_TKT_OVER)){
//	            			 cell2 = new PdfPCell(new Phrase("OK",f8));
//	            		 }else{
//	            			 cell2 = new PdfPCell(new Phrase("失败",f8));
//	            		 }
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase("免费行李额\r\nALLOWANCE",f10));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 //cell2.setColspan(1);
//	            		 cell2.setNoWrap(true);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase(segvo.getBaggageWeight(),f8));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 table2.setWidthPercentage(100);
//	            		 cell.addElement(table2);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 
//	            		 table1 = new PdfPTable(4);
//	            		 cell = new PdfPCell(new Phrase("第一航段自[From]",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(FndCache.getCityCodeByArptCode(segvo.getOrgApcd(),null)+"\t\t\t\t\t"/**+FndCache.getCityCodeByArptCode(segvo.getOrgApcd(),new Locale("en","US",""))*/,f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(FndCache.getAirportNameByCd(segvo.getOrgApcd(),null),f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(DateUtil.getChineseDate(segvo.getDeptDate())+"\t\t\t\t"+DateUtil.getCnDayNameOfWeek(segvo.getDeptDate())+segvo.getDeptTime()+"\t\t\t\t"+"起飞",f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 
//	            		 table1 = new PdfPTable(4);
//	            		 cell = new PdfPCell(new Phrase("第一航段至[To]",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//
//	            		 cell = new PdfPCell(new Phrase(FndCache.getCityCodeByArptCode(segvo.getDstApcd(),null)+"\t\t\n\t\t"/**+FndCache.getCityCodeByArptCode(segvo.getDstApcd(),new Locale("en","US",""))*/,f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(FndCache.getAirportNameByCd(segvo.getDstApcd(),null),f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(DateUtil.getChineseDate(segvo.getArrvDate())+"\t\t\t\t"+DateUtil.getCnDayNameOfWeek(segvo.getArrvDate())+segvo.getArrvTime()+"\t\t\t\t"+"到达",f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 
//	            		 table1 = new PdfPTable(4);
//	            		 cell = new PdfPCell(new Phrase("第一航段有效期\r\nThe valid period of 1 segment",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase("",f8));
////	            		 cell = new PdfPCell(new Phrase(DateUtil.toString(segvo.getDeptDate(), DateUtil.yyyy_MM_dd_HH_mm_ss),f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setColspan(3);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 //add by xuxu 0406
//	            		 table1 = new PdfPTable(4);
//	            		 cell = new PdfPCell(new Phrase("航意险\r\n INSURANCE",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 Set items = segvo.getPnrItemVOs();
//	            		 Iterator itItem = items.iterator();
//	            		 PnrItemVO useItem = null;
//	            		 while(itItem.hasNext()){
//	            			 PnrItemVO itemVO = (PnrItemVO) itItem.next();
//	            			 if(itemVO.getDelFlag()==BaseConst.STATUS_VALIDATE&&itemVO.getPnrSegVO().getId()==segvo.getId()&&itemVO.getPnrPaxVO().getId()==paxvo.getId()){
//	            				 useItem = itemVO;
//	            				 break;
//	            			 }
//	            		 }
//	            		 String str = "";
//	            		 if(useItem==null){
//	            			 str = "未购买";
//	            		 }else if(useItem.getInsurCount()==null){
//	            			 str = "未购买";
//	            		 }else if(useItem.getInsurCount() == 1){
//	            			 str = "已购买";
//	            		 }else if(useItem.getInsurCount() > 1){
//	            			 str = "已购买 " + useItem.getInsurCount() + "份";
//	            		 }else{
//	            			 str = "未购买";
//	            		 }
//	            		
//	            		 cell = new PdfPCell(new Phrase("   "+str,f8));
////	            		 cell = new PdfPCell(new Phrase(DateUtil.toString(segvo.getDeptDate(), DateUtil.yyyy_MM_dd_HH_mm_ss),f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 table1.addCell(cell);
//	            		 //cell.setColspan(3);
//	            		 cell = new PdfPCell(new Phrase("保险状态\t\n STATUS",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(useItem==null||useItem.getRecInsureVO()==null||ValidateUtil.isNullOrEmpty(useItem.getRecInsureVO().getStatus())?"    保险无效":"   "+FndCache.getDictName(useItem.getRecInsureVO().getStatus(),null),f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 //end
//	            		 table1 = new PdfPTable(4);
//	            		 cell = new PdfPCell(new Phrase("限制条件\r\nRESTRICTIONS",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell); String a=ValidateUtil.isNullOrEmpty(segvo.getSegComment())?"无限制":segvo.getSegComment();
//	            		 cell = new PdfPCell(new Phrase("   "+a,f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_LEFT);
//	            		// cell.
//	            		 cell.setColspan(3);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 //第二航段
//	            		 segvo = paxvo.getSecondPnrSegVO();
//	            		 if(segvo!=null){
//	            		 
//	            		 sales+=segvo.getPriceByPax(paxvo.getPaxType());
//	            		 tax+=segvo.getTaxAllByPax(paxvo.getPaxType());
//                    	 table1 = new PdfPTable(4);
//                    	 cell = new PdfPCell(new Phrase("订座纪录编号\r\nBOOKING REFERENCE",f10));
//                    	 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//                    	 table1.addCell(cell);
//	            		 cell= new PdfPCell();
//	            		 cell.setColspan(3);
//	            		 cell.setPaddingLeft(0);
//	            		 cell.setPaddingRight(0);
//	            		 cell.setPaddingTop(0);
//	            		 cell.setPaddingBottom(0);
//	            		 cell.setPadding(0);
//	            		  table2 = new PdfPTable(5);
//	            		   cell2 = new PdfPCell(new Phrase(pnrVO.getPnrNo(),f8));
//	            		 cell2.setFixedHeight(35);
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase("航班号\r\nFLIGHT",f10));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase(segvo.getFlightNo(),f8));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase("舱位\r\nCLASS",f10));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase(segvo.getCabinCodeCn(),f8));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 table2.setWidthPercentage(100);
//	            		 cell.addElement(table2);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 
//	            		 table1 = new PdfPTable(4);
//                    	 cell = new PdfPCell(new Phrase(null,f10));
//                    	 table1.addCell(cell);
//	            		 cell= new PdfPCell();
//	            		 cell.setColspan(3);
//	            		 cell.setPaddingLeft(0);
//	            		 cell.setPaddingRight(0);
//	            		 cell.setPaddingTop(0);
//	            		 cell.setPaddingBottom(0);
//	            		 cell.setPadding(0);
//	            		  table2 = new PdfPTable(5);
//	            		  cell2 = new PdfPCell(new Phrase(null,f8));
//	            		 cell2.setFixedHeight(35);
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase("订座情况\r\nSTATUS",f10));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 if(pnrVO.getPnrStatus().equals(BaseConst.ORDERSTATUS_TKT_OVER)){
//	            			 cell2 = new PdfPCell(new Phrase("OK",f8));
//	            		 }else{
//	            			 cell2 = new PdfPCell(new Phrase("失败",f8));
//	            		 }
//	            		 
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase("免费行李额\r\nALLOWANCE",f10));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 cell2.setNoWrap(true);
//	            		 table2.addCell(cell2);
//	            		 cell2 = new PdfPCell(new Phrase(segvo.getBaggageWeight(),f8));
//	            		 cell2.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table2.addCell(cell2);
//	            		 table2.setWidthPercentage(100);
//	            		 cell.addElement(table2);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 
//	            		 table1 = new PdfPTable(4);
//	            		 cell = new PdfPCell(new Phrase("第二航段自[From]",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//
//	            		 cell = new PdfPCell(new Phrase(FndCache.getCityCodeByArptCode(segvo.getOrgApcd(),null)+"\t\t\n\t\t"/**+FndCache.getCityCodeByArptCode(segvo.getOrgApcd(),new Locale("en","US",""))*/,f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(FndCache.getAirportNameByCd(segvo.getOrgApcd(),null),f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(DateUtil.getChineseDate(segvo.getDeptDate())+"\t\t\t\t"+DateUtil.getCnDayNameOfWeek(segvo.getDeptDate())+segvo.getDeptTime()+"\t\t\t\t"+"起飞",f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 
//	            		 table1 = new PdfPTable(4);
//	            		 cell = new PdfPCell(new Phrase("第二航段至[To]",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(FndCache.getCityCodeByArptCode(segvo.getDstApcd(),null)+"\t\t\t\t\t"/**+FndCache.getCityCodeByArptCode(segvo.getDstApcd(),new Locale("en","US",""))*/,f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(FndCache.getAirportNameByCd(segvo.getDstApcd(),null),f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(DateUtil.getChineseDate(segvo.getArrvDate())+"\t\t\t\t"+DateUtil.getCnDayNameOfWeek(segvo.getArrvDate())+segvo.getArrvTime()+"\t\t\t\t"+"到达",f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 
//	            		 table1 = new PdfPTable(4);
//	            		 cell = new PdfPCell(new Phrase("第二航段有效期\r\nThe valid period of 1 segment",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase("",f8));
////	            		 cell = new PdfPCell(new Phrase(DateUtil.toString(segvo.getDeptDate(), DateUtil.yyyy_MM_dd_HH_mm_ss),f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setColspan(3);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 //add by xuxu 0406
//	            		 table1 = new PdfPTable(4);
//	            		 cell = new PdfPCell(new Phrase("航意险\r\n INSURANCE",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 Set itemsTwo = segvo.getPnrItemVOs();
//	            		 Iterator itItemTwo = itemsTwo.iterator();
//	            		 useItem = null;
//	            		 while(itItemTwo.hasNext()){
//	            			 PnrItemVO itemVO = (PnrItemVO) itItemTwo.next();
//	            			 if(itemVO.getDelFlag()==BaseConst.STATUS_VALIDATE&&itemVO.getPnrSegVO().getId()==segvo.getId()&&itemVO.getPnrPaxVO().getId()==paxvo.getId()){
//	            				 useItem = itemVO;
//	            				 break;
//	            			 }
//	            		 }
//	            		  str = "";
//	            		 if(useItem==null){
//	            			 str = "未购买";
//	            		 }else if(useItem.getInsurCount()==null){
//	            			 str = "未购买";
//	            		 }else if(useItem.getInsurCount() == 1){
//	            			 str = "已购买";
//	            		 }else if(useItem.getInsurCount() > 1){
//	            			 str = "已购买 " + useItem.getInsurCount() + "份";
//	            		 }else{
//	            			 str = "未购买";
//	            		 }
//	            		
//	            		 cell = new PdfPCell(new Phrase("  "+str,f8));
////	            		 cell = new PdfPCell(new Phrase(DateUtil.toString(segvo.getDeptDate(), DateUtil.yyyy_MM_dd_HH_mm_ss),f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 table1.addCell(cell);
//	            		 //cell.setColspan(3);
//	            		 cell = new PdfPCell(new Phrase("保险状态\t\n STATUS",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell);
//	            		 cell = new PdfPCell(new Phrase(useItem==null||useItem.getRecInsureVO()==null||ValidateUtil.isNullOrEmpty(useItem.getRecInsureVO().getStatus())?"    保险无效":"   "+FndCache.getDictName(useItem.getRecInsureVO().getStatus(),null),f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 //end
//	            		 table1 = new PdfPTable(4);
//	            		 cell = new PdfPCell(new Phrase("限制条件\r\nRESTRICTIONS",f10));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            		 table1.addCell(cell); 
//	            		 String a1=ValidateUtil.isNullOrEmpty(segvo.getSegComment())?"无限制":segvo.getSegComment();
//	            		 cell = new PdfPCell(new Phrase("   "+a1,f8));
//	            		 cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            		 cell.setHorizontalAlignment(Element.ALIGN_LEFT);
//	            		 cell.setColspan(3);
//	            		 table1.addCell(cell);
//	            		 document.add(table1);
//	            		 }
//	            		 
//	            		 document.add(new Paragraph(Chunk.NEWLINE));/**添加空行**/
//	            	}
//	            	document.add(new PdfPTable(4));/**添加空行**/
//	    			
//	            	PdfPTable 	table5 = new PdfPTable(4);
//	            	PdfPCell  cell5 = new PdfPCell(new Phrase("实际支付金额\r\nFARE PAID",f10));
//	            	cell5.setVerticalAlignment(Element.ALIGN_MIDDLE);
//	            	cell5.setHorizontalAlignment(Element.ALIGN_CENTER);
//	            	table5.addCell(cell5);
//	            	// 钱数重新赋值 by zhangyl
//	            	if(pnrid!=null){
//	            		cell5 = new PdfPCell(new Phrase(pnrVO.getOrdPayVO().getPayCurrency()==null?"CNY"+amount.longValue()+"":pnrVO.getOrdPayVO().getPayCurrency()+amount.longValue()+"",f8));
//	            	}
//	            	else{
//	            		cell5 = new PdfPCell(new Phrase(pnrVO.getOrdPayVO().getPayCurrency()==null?"CNY"+pnrVO.getAmount().longValue()+"":pnrVO.getOrdPayVO().getPayCurrency()+pnrVO.getAmount().longValue()+"",f8));
//	            	}
////           		cell5 = new PdfPCell(new Phrase(pnrVO.getOrdPayVO().getPayCurrency()+pnrVO.getAmount()+"(税费："+(pnrVO.getYqTaxAmt()+pnrVO.getCnTaxAmt())+")",f8));
//           		cell5.setVerticalAlignment(Element.ALIGN_MIDDLE);
//           		cell5.setHorizontalAlignment(Element.ALIGN_CENTER);
//           		table5.addCell(cell5);
//           		cell5 = new PdfPCell(new Phrase("付款方式\r\nFORM OF PAYMENT",f10));
//           		cell5.setVerticalAlignment(Element.ALIGN_MIDDLE);
//           		cell5.setHorizontalAlignment(Element.ALIGN_CENTER);
//           		table5.addCell(cell5);
//           		cell5 = new PdfPCell(new Phrase(pnrVO.getRecentPayVO().getPayType()==null?"在线支付":FndCache.getDictName(pnrVO.getRecentPayVO().getPayType().intValue(), null),f8));
//           		cell5.setVerticalAlignment(Element.ALIGN_MIDDLE);
//           		cell5.setHorizontalAlignment(Element.ALIGN_CENTER);
//           		table5.addCell(cell5);
//           		 document.add(table5);
//           		document.add(new Paragraph(Chunk.NEWLINE));/**添加空行**/
//	            }
//	            PdfPTable 	table6 = new PdfPTable(1);
//	            PdfPCell  cell6 = new PdfPCell(new Phrase("此行程提示不作报销凭证\t\t\twww.ceair.com \t\t服务热线：(021) 95530",FontChineseTit));
//	            cell6.setVerticalAlignment(Element.ALIGN_MIDDLE);
//            	cell6.setHorizontalAlignment(Element.ALIGN_CENTER);
//            	cell6.setFixedHeight(50);
//	            table6.addCell(cell6);
//	            document.add(table6);
//	            document.add(new Paragraph(Chunk.NEWLINE));/**添加空行**/
//            	gra = new Paragraph("请您提前60分钟到机场办理登机手续 [中国东方航空]",red);
//    			gra.setAlignment(Element.ALIGN_CENTER);
//    			
//    			document.add(gra);
//			}
//			document.close();
//		}
//        }catch(Exception e){
//        	e.printStackTrace();
//        	document.close();
//        	return "fail";
//		}
//		return "ok";
//	}
//	public String getCityNameByArpCode(String code,Locale locale){
//		FndCache.getCityCodeByArptCode(code, locale);
//		
//		return null;
//	}
//	/**
//	 * 生成pdf文档
//	 * @param args
//	 * @throws Exception
//	 */
//	
////	public static String createPdfOfOrder(List list,String file)throws Exception{
////		Document document = new Document(PageSize.A4, 50, 50, 50, 50);
//////		String filePath = PdfWriteUtil.class.getResource("/").getPath()+"../download/";
//////        String fileName = "东航订单详情" +new SimpleDateFormat("yyyyMMddHHmmssss").format(new Date())+".pdf";
////		try{		
////		if(list!=null&&list.size()>0){
////			BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);    
////            Font FontChinese = new Font(bfChinese, 12, Font.NORMAL); 
////            Font f8 = new Font(bfChinese, 10, Font.NORMAL);
////            Font f10 = new Font(bfChinese, 10, Font.BOLDITALIC);
////            Font f12 = new Font(bfChinese, 12, Font.BOLD);
////            Font FontChineseTit = new Font(bfChinese, 22, Font.NORMAL); 
////            Font red = new Font(bfChinese, 8, Font.BOLD,new Color(255,0,0));
////           // FontChineseTit.setStyle("alignment:"+Element.ALIGN_RIGHT);
////            //file path 
////            
////			PdfWriter writer = PdfWriter.getInstance(document,new FileOutputStream(file));
////			
////			document.addAuthor("中国东方航空");   
////			document.addSubject("中国东方航空订单详情");
////			 
////		       /**加入显示页码**/
////		       HeaderFooter footer = new HeaderFooter(new Phrase("page: "), true);
////		       footer.setBorder(com.lowagie.text.Rectangle.NO_BORDER);
////		       footer.setAlignment(Element.ALIGN_RIGHT);
////		       document.setFooter(footer);
////
////			document.open();
////			PdfPTable tableImg = new PdfPTable(1);
////			String path = new PathDetector().getResult();
////			Image img1 =Image.getInstance(path+"/buytkt.jpg");
////			PdfPCell cellImg = new PdfPCell(img1,false);
////			tableImg.addCell(cellImg);
////			document.add(tableImg);
////			Paragraph gra = new Paragraph("中国东方航空订单详情",FontChineseTit);
////			gra.setAlignment(Element.ALIGN_CENTER);
////			document.add(gra); 
////			 document.add(new Paragraph(Chunk.NEWLINE));/**添加空行**/
////			for(int i=0;i<list.size();i++){
////				OrdInfoVO ordVO = (OrdInfoVO) list.get(i);				  
////	            document.add(new Paragraph(" 订单号："+ordVO.getOrdNo()+"\t\t\t\t\t\t\t\t\t\t\t\t\t\t合计总价："+ordVO.getPayAmount()+"元",FontChinese)); 
////	            document.add(new Paragraph(Chunk.NEWLINE));/**添加空行**/
////	            //divide by pnrvo
////	            Set pnrset = ordVO.getPnrInfoVOs();
////	            Iterator it = pnrset.iterator();
////	            while(it.hasNext()){
////	            	PdfPTable table1 = new PdfPTable(4);
////	            	int headerwidths[] = { 10, 20, 12, 15};   
////		            table1.setWidths(headerwidths);
////		            
////	            	//table1.setAlignment(Element.ALIGN_TOP);
////	            	 
////		            // generate table head 
////		            PdfPCell cell = new PdfPCell(new Phrase("姓名",FontChinese));
////		            //cell.setHeader(true);
////		            cell.setFixedHeight(25);
////		            cell.setBackgroundColor(new Color(0,255,0));
////		            cell.setHorizontalAlignment(Element.ALIGN_CENTER);
////		            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
////		           
////		            table1.addCell(cell);
////		           // cell = new PdfPCell(new Phrase("证件号码",FontChinese));
////		            cell.setPhrase(new Phrase("证件号码",FontChinese));
////		            table1.addCell(cell);
////		           // cell = new PdfPCell(new Phrase("婴儿携带者",FontChinese));
////		            cell.setPhrase(new Phrase("婴儿携带者",FontChinese));
////		            table1.addCell(cell);
////		           // cell = new PdfPCell(new Phrase("票号",FontChinese));
////		            cell.setPhrase(new Phrase("票号",FontChinese));
////		            table1.addCell(cell);
////		            //table1.endHeaders();
////		            //generate table body
////	            	PnrInfoVO pnrVO = (PnrInfoVO) it.next();
////	            	Set  paxSet = pnrVO.getPnrPaxSet();
////	            	
////	            	for(Iterator itpax=paxSet.iterator();itpax.hasNext();){
////	            		PnrPaxVO paxVO = (PnrPaxVO) itpax.next();
////	            		
////	            		OrdTktVO tktVO = ((PnrItemVO)paxVO.getPnrItemVOs().iterator().next()).getOrdTktVO();
////	            		cell = new PdfPCell(new Phrase(paxVO.getPaxName(),FontChinese));
////	            		table1.addCell(cell);
////	            		cell = new PdfPCell(new Phrase(paxVO.getIdNo(),FontChinese));
////	            		table1.addCell(cell);
////	            		cell = new PdfPCell(new Phrase(paxVO.getContactId(),FontChinese));
////	            		table1.addCell(cell);
////	            		//cell = new PdfPCell(new Phrase(tktVO.getTktNo()));
////	            		table1.addCell(cell);
////	            	}
////	            	document.add(table1);
////	            	document.add(new Paragraph(" 联系人："+ordVO.getContactName()+"\t\t\t\t\t\t\t\t\t\t手机："+ordVO.getContactMobile(),FontChinese)); 
////	            	 document.add(new Paragraph(Chunk.NEWLINE));/**添加空行**/
////	            	PdfPTable table2 = new PdfPTable(2);
////	            	int headerwidths2[] = { 10, 60};
////	            	table2.setWidths(headerwidths2);
////	            	//table2.setLockedWidth(true);
////	            	Set segSet = pnrVO.getPnrSegSet();
////	            	for(Iterator itseg=segSet.iterator();itseg.hasNext();){
////	            		PnrSegVO segVO = (PnrSegVO) itseg.next();
////	            		PdfPTable table4 = new PdfPTable(1);
////	            		PdfPCell cellSpan = new PdfPCell(new Phrase(segVO.getFlightNo(),FontChinese));
////	            		cellSpan.setHorizontalAlignment(Element.ALIGN_CENTER);
////	            		cellSpan.setVerticalAlignment(Element.ALIGN_MIDDLE);
////	            		// table4.addCell(cellSpan);
//////	            		 cellSpan = new PdfPCell(new Phrase(""));
//////	            		 table4.addCell(cellSpan);
////	            		
//////	            		cellSpan.setHorizontalAlignment(Element.ALIGN_CENTER);
//////	            		Image img1 =Image.getInstance("d:/icon_user_gray.gif");
//////	            		Image img2 =Image.getInstance("d:/icon_cea_small_greybg.gif");
//////	            		img2.getScaledHeight();
//////	            		Image img3 =Image.getInstance("d:/icon_coffee_cup.gif");
//////	            		cellSpan = new PdfPCell(img2,false);
//////	            		//cellSpan.setFixedHeight(3);
//////	            		table4.addCell(cellSpan);
//////	            		cellSpan = new PdfPCell(new Phrase(segVO.getFlightNo(),FontChinese));
////	            		table4.addCell(cellSpan);
////	            		cellSpan = new PdfPCell(table4);
////	            		table2.addCell(cellSpan);
////	            		PdfPTable table5 = new PdfPTable(4);
////	            		cell = new PdfPCell(new Phrase("始发",FontChinese));
////	            		table5.addCell(cell);
////	            		cell = new PdfPCell(new Phrase(segVO.getOrgApcdCn(),FontChinese));
////	            		table5.addCell(cell);
////	            		cell = new PdfPCell(new Phrase(segVO.getDeptDateStr()+" "+segVO.getDeptTime(),FontChinese));
////	            		table5.addCell(cell);
////	            		cell = new PdfPCell(new Phrase(segVO.getAcFamily(),FontChinese));
////	            		table5.addCell(cell);
////	            		cell = new PdfPCell(new Phrase("到达",FontChinese));
////	            		table5.addCell(cell);
////	            		cell = new PdfPCell(new Phrase(segVO.getDstApcdCn(),FontChinese));
////	            		table5.addCell(cell);
////	            		cell = new PdfPCell(new Phrase(segVO.getArrvDateStr()+" "+segVO.getArrvTime(),FontChinese));
////	            		table5.addCell(cell);
////	            		if(segVO.getSegVia()!=null&&segVO.getSegVia().equals("7")){
////	            			cell = new PdfPCell(new Phrase("无经停",FontChinese));
////	            		}else{
////	            			cell = new PdfPCell(new Phrase("有经停",FontChinese));
////	            		}
////	            		
////	            		table5.addCell(cell);
////	            		cellSpan = new PdfPCell(table5);
////	            		//cellSpan.set
////	            		table2.addCell(cellSpan);
////	            	}
////	            	
////	            	document.add(table2);
////	            	
////	    			 document.add(new Paragraph(Chunk.NEWLINE));/**添加空行**/
////	            }
////	            document.add(new Paragraph(Chunk.NEWLINE));/**添加空行**/
////            	gra = new Paragraph("请您提前60分钟到机场办理登机手续 [中国东方航空]",red);
////    			gra.setAlignment(Element.ALIGN_CENTER);
////    			
////    			document.add(gra);
////			}
////			document.close();
////		}
////        }catch(Exception e){
////        	e.printStackTrace();
////        	document.close();
////        	return "fail";
////		}
////		return "ok";
////	}
//
//	public static void main(String []args) throws Exception{
////		BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",BaseFont.NOT_EMBEDDED);
////		BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",    
////			           BaseFont.NOT_EMBEDDED);    
////			              
////			Font FontChinese = new Font(bfChinese, 22, Font.BOLD);   
//			      
//		Document document = new Document(PageSize.A4, 50, 50, 50, 50);
//		PdfWriter writer = PdfWriter.getInstance(document,new FileOutputStream("C:\\ITextTest.pdf"));
//		document.addAuthor("中国东方航空");   
//		document.addSubject("中国东方航空订单详情");
//		document.open();
////		HeaderFooter header = new HeaderFooter(new Phrase("This is a header without a page number"), false);
////		//document.add(header);
////		 document.add(new Paragraph("东方航空订单信息详情",FontChinese)); 
//////		document.add(new Paragraph("First page of the document.中文"));
//////		document.add(new Paragraph("Some 中文more text on the first page with different color and font type.", 
//////		FontFactory.getFont(FontFactory.COURIER, 14, Font.BOLD, new Color(255, 150, 200))));
////
////		
////		
////		Paragraph title1 = new Paragraph("Chapter 1", 
////		           FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC, new Color(0, 0, 255)));
////		Chapter chapter1 = new Chapter(title1, 0);
////		chapter1.setNumberDepth(1);
////
////
////		Paragraph title11 = new Paragraph("This is Section 1 in Chapter 1", 
////		           FontFactory.getFont(FontFactory.HELVETICA, 16, Font.BOLD, new Color(255, 0, 0)));
////		Section section1 = chapter1.addSection(title11);
////		Paragraph someSectionText = new Paragraph("This text comes as part of section 1 of chapter 1.");
////		section1.add(someSectionText);
////		someSectionText = new Paragraph("Following is a 3 X 2 table.");
////		section1.add(someSectionText);
////		
////		Table t = new Table(3,2);
////		t.setBorderColor(new Color(220, 255, 100));
////		t.setPadding(5);
////		t.setSpacing(5);
////		t.setBorderWidth(1);
////		Cell c1 = new Cell("header1");
////		c1.setHeader(true);
////		t.addCell(c1);
////		c1 = new Cell("中文");
////		t.addCell(c1);
////		c1 = new Cell("Header3");
////		t.addCell(c1);
////		t.endHeaders();
////		t.addCell("1.1");
////		t.addCell("1.2");
////		t.endHeaders();
////		t.addCell("1.3");
////		t.addCell("1.4");
////		section1.add(t);
////
////		List l = new List(true, false, 10);
////		l.add(new ListItem("First item of list"));
////		l.add(new ListItem("Second item of list"));
////		section1.add(l);
////
////		
////		document.add(chapter1);
//		
//		
//		Table datatable = new Table(10);   
//		  
//		            int headerwidths[] = { 10, 24, 12, 12, 7, 7, 7, 7, 7, 7 };   
//		            datatable.setWidths(headerwidths);   
//		            datatable.setWidth(100);   
//		            datatable.setPadding(3);   
//		  
//		            // the first cell spans 10 columns   
//		            Cell cell = new Cell(new Phrase(   
//		                    "Administration -System Users Report", FontFactory.getFont(   
//		                            FontFactory.HELVETICA, 24, Font.BOLD)));   
//		            cell.setHorizontalAlignment(Element.ALIGN_CENTER);   
//		            cell.setLeading(30);   
//		            cell.setColspan(10);   
//		            cell.setBorder(Rectangle.NO_BORDER);   
//		            cell.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0));   
//		            datatable.addCell(cell);   
//		  
//		            // These cells span 2 rows   
//		            datatable.setBorderWidth(2);   
//		            datatable.setAlignment(1);   
//		            datatable.addCell("User Id");   
//		            datatable.addCell("Name\nAddress");   
//		            datatable.addCell("Company");   
//		            datatable.addCell("Department");   
//		            datatable.addCell("Admin");   
//		            datatable.addCell("Data");   
//		            datatable.addCell("Expl");   
//		            datatable.addCell("Prod");   
//		            datatable.addCell("Proj");   
//		            datatable.addCell("Online");   
//		  
//		            // this is the end of the table header   
//		            datatable.endHeaders();   
//		  
//		           datatable.setBorderWidth(1);   
//		  
//		           for (int i = 1; i < 2; i++) {   
//		 
//		               datatable.setAlignment(Element.ALIGN_LEFT);   
//		  
//		                datatable.addCell("myUserId");   
//		                datatable   
//		                       .addCell("Somebody with a very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very, very long long name");   
//		                datatable.addCell("No Name Company");   
//		               datatable.addCell("D" + i);   
//		  
//		               datatable.setAlignment(Element.ALIGN_CENTER);   
//		               datatable.addCell("No");   
//		               datatable.addCell("Yes");   
//		                datatable.addCell("No");   
//		                datatable.addCell("Yes");   
//		                datatable.addCell("No");   
//		                datatable.addCell("Yes");   
//		  
//		            }   
//		           BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);    
//		            Font FontChinese = new Font(bfChinese, 12, Font.NORMAL);   
//		            document.add(new Paragraph(" 产生的报告",FontChinese));   
//		            document.add(datatable);   
//		            document.newPage();   
//		           document.add(new Paragraph(   
//		                    "com.lowagie.text.pdf.PdfPTable - Cells split\n\n"));   
//		            datatable.setConvert2pdfptable(true);   
//		            document.add(datatable);   
//		            document.newPage();   
//		           document.add(new Paragraph(   
//		                    "com.lowagie.text.Table - Cells kept together"));   
//		            datatable.setConvert2pdfptable(false);   
//		           datatable.setCellsFitPage(true);   
//		            document.add(datatable);   
//		            document.newPage();   
//		            document   
//		                    .add(new Paragraph(   
//		                           "com.lowagie.text.pdf.PdfPTable - Cells kept together\n\n"));   
//		           datatable.setConvert2pdfptable(true);   
//		           document.add(datatable);   
//		document.close();  
//	}
}
